using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using FSS.DAL.DBManagers;
using FSS.BLL.Entities;
namespace FSS.BLL.Services
{
	#region IVoucherInService

	/// <summary>
	/// VoucherInService object for Ibatis mapped table 'VoucherIn'.
	/// </summary>
	public class IVoucherInService : BaseSqlMapDao
	{
		private static readonly ILog log = LogManager.GetLogger(typeof(IVoucherInService).Name);
	  	
		public IList<VoucherInEntity> LoadAll()
        {
            try
            {
                return ExecuteQueryForList< VoucherInEntity>("VoucherInLoadAll", null);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
       public VoucherInEntity LoadByPrimaryKey(VoucherInEntity objE)
        {
            try
            {
                return ExecuteQueryForObject< VoucherInEntity>("VoucherInLoadByPrimaryKey", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
        
        /// <summary>
        /// add new VoucherIn to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Insert(VoucherInEntity objE)
        {
            try
            {
              
                ExecuteInsert("VoucherInInsert", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
        /// <summary>
        /// update VoucherIn to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Update(VoucherInEntity objE)
        {
            try
            {
                ExecuteUpdate("VoucherInUpdate", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
        /// <summary>
        /// delete VoucherIn to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public bool Delete(Int64 VoucherInId)
        {
            VoucherInEntity objE = new VoucherInEntity
            {
                VoucherInId = VoucherInId
            };
          int Resul=(int)ExecuteDelete("VoucherInDelete", objE);
          return (Resul > 0);
         
         
        }
	}
	#endregion  
}
